package com.blockmeta.bbs.immodule.activity;

import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blockmeta.bbs.businesslibrary.arouter.RouterPath;
import com.blockmeta.bbs.businesslibrary.base.BaseActivity;
import com.blockmeta.bbs.immodule.R;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

@Route(path = RouterPath.IM_PERSONAL_MSG_ACTIVITY)
public class ImPersonalMsgActivity extends BaseActivity {


    @Override
    protected boolean showTitle() {
        return true;
    }

    @Override
    public View setView() {
        return getLayoutInflater().inflate(R.layout.activity_im_carrier, null);
    }

    @Override
    protected void initialize() {
        super.initialize();
        setTitleText("我的消息");
        addFragment();
    }

    private void addFragment() {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        Fragment fragment = (Fragment) ARouter.getInstance().build(RouterPath.IM_PERSONAL_MSG_FRAGMENT).navigation();
        if (fragment==null){return;}
        if (!fragment.isAdded()){
            transaction.add(R.id.fragment_container,fragment).commitAllowingStateLoss();
        }
    }
}
